package add_$13_LinePriority;

public class Test {
    
    public static void main(String[] args) {
        //创建两个线程
        Thread minPriority = new Thread(new MinPriority(), "优先级较低的线程");
        Thread maxPriority = new Thread(new MaxPriority(), "优先级较高的线程");
        minPriority.setPriority(Thread.MIN_PRIORITY);
        maxPriority.setPriority(Thread.MAX_PRIORITY);
        //开启两个线程
        minPriority.start();
        maxPriority.start();
    }
}
//定义类Maxpriority实现Runnable接口
class MaxPriority implements Runnable {
    public void run() {
        for(int i = 0; i < 100; i++) {
            System.out.println(Thread.currentThread().getName() + "正在输出：" + i);
        }
    }
}
//定义MinPriority实现Runnable接口
class MinPriority implements Runnable {
    public void run() {
        for(int i = 0; i < 100; i++) {
            System.out.println(Thread.currentThread().getName() + "正在输出：" + i);
        }
    }
}
